package com.ling.dataStructures.hash_table;

import com.sun.org.slf4j.internal.Logger;
import com.sun.org.slf4j.internal.LoggerFactory;

/**
 * @author: ling007
 * @date: 2025/2/6 16:18
 * @description:
 */

public class HashMap01<K,V> implements Map<K,V> {

    private final Logger logger = LoggerFactory.getLogger(HashMap01.class);

    private final Object[] tab = new Object[8];

    @Override
    public void put(K key, V value) {
        int idx = key.hashCode() & (tab.length - 1);
        tab[idx] = value;
    }

    @Override
    public V get(K key) {
        int idx = key.hashCode() & (tab.length - 1);
        return (V) tab[idx];
    }

}
